package com.apes.autoparts.masterdata.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @ClassName PartsName
 * @Description 配件名称
 * @Author pengyb
 * @Date 2019/9/29 10:48
 * @Version 1.0
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = EpcPartsName.CONST_TABLE_NAME)
public class EpcPartsName implements ApesBean {
    public static final String CONST_TABLE_NAME = "mas_pjmc";

    @Id
    @Column(name = "PJMCID")
    @Comment("配件名称编码")
    private String id;

    @NotNull
    @Column(name = "PJMC", length = 64)
    @Comment("配件名称")
    private String name;

    @NotNull
    @Column(name = "PLID", length = 16)
    @Comment("品类编码")
    private String categoryId;

    @NotNull
    @Column(name = "PLMC", length = 64)
    @Comment("品类名称")
    private String categoryName;

    @NotNull
    @Column(name = "TS01", length = 36)
    @Comment("TS01")
    private String time;

    @NotNull
    @Column(name = "LRR", length = 64)
    @Comment("录入人")
    private String creatorName;

    @NotNull
    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.DATE)
    @Column(name = "LRRQ_SJ")
    @Comment("录入日期")
    private Date entryDate; //录入日期

    @Column(name = "PYM", length = 64)
    @Comment("拼音码")
    private String pinYinMa;

    @Column(name = "JJHSBJ", columnDefinition = "number(2)")
    @Comment("旧件需回收")
    private Integer recycle;

    @NotNull
    @Column(name = "PPSPBJ", columnDefinition = "number(2) default 1")
    @Comment("匹配商品(0:否;1:是)")
    private Integer matchingProduct;

    @NotNull
    @Column(name = "PPYSBJ", columnDefinition = "number(2) default 0")
    @Comment("匹配颜色(0:否;1:是)")
    private Integer matchingColor;

    @Column(name = "DZYQJ", columnDefinition = "number(2) default 0")
    @Comment("电子元器件(0:否;1:是)")
    private Integer electronComponent;

    @Column(name = "UOMID")
    @Comment("计量单位编码")
    private String uomId;

    @Column(name = "UOMNAME")
    @Comment("计量单位名称")
    private String uomName;

}
